// Copyright (c) 2021 Presto Labs Pte. Ltd.
// Author: leon

#include "coin2/exchange/factory/feed/symbol_updater.h"

#include <memory>
#include <string>

#include "coin2/exchange/base/market/enums.h"
#include "coin2/exchange/coingecko/feed_v3/symbol_updater.h"
#include "coin2/exchange/deribit_options/feed_v2/symbol_updater.h"

namespace coin2::exchange::factory::feed {
namespace impl {

using namespace coin::proto;

std::shared_ptr<base::feed::SymbolUpdater> NewSymbolUpdater(
    const MarketExchangeApi& mea) {
  if (mea == MarketExchangeApi {Options, Deribit, "v2"}) {
    return std::make_shared<deribit_options::feed_v2::DeribitOptionsSymbolUpdater>(mea);
  } else if (mea == MarketExchangeApi {Spot, Coingecko, "v3"}) {
    return std::make_shared<coingecko::feed_v3::CoingeckoSymbolUpdater>(mea);
  } else {
    THROW() << "[Symbol Updater] not implemented for " << mea.String();
  }
  return nullptr;
}
}  // namespace impl
using impl::NewSymbolUpdater;
}  // namespace coin2::exchange::factory::feed
